//
//  PlanHeadCell.m
//  test
//
//  Created by 朱圳 on 2018/1/11.
//  Copyright © 2018年 朱圳. All rights reserved.
//

#import "PlanHeadCell.h"
#import "UILabel+HgLabel.h"

@implementation PlanHeadCell

- (instancetype)initWithReuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithReuseIdentifier:reuseIdentifier];
    if (self) {
        [self createSubViews];
    }
    return self;
}
-(void)createSubViews{
    
    self.contentView.backgroundColor = [UIColor whiteColor];
    UILabel *kmLab = [[UILabel alloc]init];
    kmLab.text = @"科目";
    kmLab.textAlignment = NSTextAlignmentCenter;
    [self.contentView addSubview:kmLab];
    [kmLab mas_updateConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(40);
        make.centerY.mas_equalTo(self);
        make.width.mas_equalTo(40);
    }];
    
    UILabel *contentLab = [[UILabel alloc]init];
    contentLab.text = @"内容";
    contentLab.textAlignment = NSTextAlignmentCenter;
    [self.contentView addSubview:contentLab];
    // 布局
    [contentLab mas_updateConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(contentLab.superview.mas_left).with.offset(90);
        make.right.equalTo(contentLab.superview.mas_right).with.offset(-40);
        make.centerY.mas_equalTo(self);
    }];
    
    /**********************分割线******************************/
    //顶部
    UIView *xview1 = [[UIView alloc]init];
    xview1.backgroundColor = [UIColor darkGrayColor];
    [self.contentView addSubview:xview1];
    [xview1 mas_makeConstraints:^(MASConstraintMaker *make) {
        [make.left.mas_equalTo(kmLab.mas_left) setOffset:-10];
        make.top.mas_equalTo(self);
        make.height.mas_equalTo(0.5);
        [make.right.mas_equalTo(contentLab.mas_right) setOffset:10];
    }];
    //底部
    UIView *xview2 = [[UIView alloc]init];
    xview2.backgroundColor = [UIColor darkGrayColor];
    [self.contentView addSubview:xview2];
    [xview2 mas_makeConstraints:^(MASConstraintMaker *make) {
        [make.left.mas_equalTo(kmLab.mas_left) setOffset:-10];
        make.bottom.mas_equalTo(self);
        make.height.mas_equalTo(0.5);
        [make.right.mas_equalTo(contentLab.mas_right) setOffset:10];
    }];
    //竖线
    UIView *xview3 = [[UIView alloc]init];
    xview3.backgroundColor = [UIColor darkGrayColor];
    [self.contentView addSubview:xview3];
    [xview3 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(xview2.mas_left);
        make.bottom.mas_equalTo(self);
        make.top.mas_equalTo(self);
        make.width.mas_equalTo(1);
    }];
    
    UIView *xview4 = [[UIView alloc]init];
    xview4.backgroundColor = [UIColor darkGrayColor];
    [self.contentView addSubview:xview4];
    [xview4 mas_makeConstraints:^(MASConstraintMaker *make) {
        [make.left.mas_equalTo(kmLab.mas_right) setOffset:8];
        make.bottom.mas_equalTo(self);
        make.top.mas_equalTo(self);
        make.width.mas_equalTo(1);
    }];
    
    UIView *xview5 = [[UIView alloc]init];
    xview5.backgroundColor = [UIColor darkGrayColor];
    [self.contentView addSubview:xview5];
    [xview5 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(xview2.mas_right);
        make.bottom.mas_equalTo(self);
        make.top.mas_equalTo(self);
        make.width.mas_equalTo(1);
    }];
    
}
@end

